package cn.edu.xmu.orderpayment.payment.microservice.service;

import cn.edu.xmu.orderpayment.payment.microservice.returnobj.WeChatReturnObject;
import cn.edu.xmu.orderpayment.payment.microservice.wechatpayvo.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @author Yujie Lin
 * @date 2021/12/12 19:09
 */
@FeignClient("wechatpay-service")
public interface WeChatPayService {

    @PostMapping("/internal/wechat/pay/transactions/jsapi")
    WeChatReturnObject<WeChatPayPrepayRetVo> createTransaction(@RequestBody WeChatPayTransactionVo weChatPayTransactionVo);

    @GetMapping("/internal/wechat/pay/transactions/out-trade-no/{out_trade_no}")
    WeChatReturnObject<WeChatPayTransactionRetVo> getTransaction(@PathVariable("out_trade_no") String outTradeNo);

    @PostMapping("/internal/wechat/pay/transactions/out-trade-no/{out_trade_no}/close")
    WeChatReturnObject closeTransaction(@PathVariable("out_trade_no") String outTradeNo);

    @PostMapping("/internal/wechat/refund/domestic/refunds")
    WeChatReturnObject<WeChatPayRefundRetVo> createRefund(@RequestBody WeChatPayRefundVo weChatPayRefundVo);

    @GetMapping("/internal/wechat/refund/domestic/refunds/{out_refund_no}")
    WeChatReturnObject<WeChatPayRefundRetVo> getRefund(@PathVariable("out_refund_no") String outRefundNo);

    @GetMapping("/internal/wechat/bill/fundflowbill")
    WeChatReturnObject<WeChatPayFundFlowBillRetVo> getFundFlowBill(@RequestParam("bill_date") String billDate);
}
